<#include "./template.ftl">

<#macro head>
<title><#if vo??>${vo.postTitle}</#if></title>
<link rel="stylesheet" href="${base}/client/css/wenda.css">
<link rel="stylesheet" href="${base}/client/css/detail.css">
</#macro>
<#macro content>
<div id="contents" class="posts-detail">

    <#if vo??>
    <div class="main wrap clearfix">

        <div class="main-left f-l clearfix">
                <div class="detail-contents">
                    <h2>${vo.postTitle}</h2>

                    <div class="tips clearfix">
                        <div class="from f-l"><span class="name"><a href="${base}/profile?userId=${vo.postAuthor!''}">${vo.postAuthorStr!''}</a></span> <span
                                class="type">${vo.roleName!''}</span> <span
                                class="time">${vo.createTimeStr}</span> <span
                                class="view">${vo.view}</span>
                        </div>
                        <div class="share f-r">分享至： <span class="social-share share-component"
                                                          data-initialized="true"><a
                                href="http://service.weibo.com/share/share.php?url=file%3A%2F%2F%2FUsers%2Fzhanshanqin%2Fproject%2Fdashboard%2Fdetail.html&amp;title=%E8%AF%A6%E6%83%85%E9%A1%B5&amp;pic=file%3A%2F%2F%2FUsers%2Fzhanshanqin%2Fproject%2Fdashboard%2F8daf2d5069d2e3aaf38c2b877cb0060c.jpg"
                                class="social-share-icon icon-weibo"></a> <a href="javascript:;"
                                                                             class="social-share-icon icon-wechat">
                            <div class="wechat-qrcode"><h4>微信扫一扫：分享</h4>

                                <div class="qrcode"><img
                                        src="">
                                </div>
                                <div class="help"></div>
                            </div>
                        </a></span></div>
                    </div>
                    <div class="detail-article">
                        <#if vo.extra4?? && '显示' == vo.extra4>
                            <img width="100%" src="${base}/system/getImg?imgId=${vo.postImg}">
                        </#if>
                        ${vo.postContent}
                    </div>
                    <div class="detail-heart">
                        <a title="喜欢就赞一个！" id="favorite" href="javascript:;" data-action="ding" data-id="${vo.id}"
                           class="${done!''}">
                            <i class="fa fa-heart"></i> Like <span class="count">${vo.guid!''}</span>
                        </a>
                    </div>
                </div>

            <#include "widget/answer.ftl"/>
            <#if next??>
                <div class="detail-next-article clearfix">
                    <label for="" class="label">下一篇</label><span class="title">${next.postTitle}</span>
                    <a class="more f-r" href="${base}/posts/${next.id}">进去看看</a>
                </div>
            </#if>
        </div>

        <div class="main-right f-r clearfix">
            <#include "widget/ad.ftl"/>
            <#include "widget/hot_posts.ftl"/>
            <#if rp??>
            <div class="pl-slide-intro relative-product">
                    <h2>相关产品</h2>
                    <ul>
                         <li>
                             <div class="pic f-l">
                                 <a href="${base}/product/id/${rp.id}"><img width="100%" src="${base}/system/getImg?imgId=${rp.iconUrl!''}&w=110" alt=""></a>
                             </div>
                             <div class="cell f-l">
                                 <a href="${base}/product/id/${rp.id}"><h4>${rp.name!''}</h4></a>
                                 <p>阶段:<span>${rp.process!''}</span></p>
                                 <p>平台:<span>${rp.platformStr!''}</span></p>
                                 <p>产品类型:<span>${rp.typeStr!''}</span></p>
                             </div>
                         </li>
                    </ul>
      
            </div>
            </#if>
        </div>
    </div>
    <#else>
        没有该文章！请看看其他的吧！
    </#if>
</div>

</#macro>
<#macro js>
<script src="${base}/client/js/detail.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        var postLike = function () {
            if ($("#favorite").hasClass('done')) {
                alert("您已赞过！");
                return false;
            } else {
                $("#favorite").addClass('done');
                var id = $("#favorite").data("id"),
                    rateHolder = $("#favorite").children('.count');
                var ajax_data = {
                    id: id
                };
                $.post("${base}/posts/up", ajax_data,
                        function (data) {
                            $(rateHolder).html(data.data);
                        });
                return false;
            }
        };
        $(document).on("click", "#favorite",
                function () {
                    postLike();
                });
    });
</script>
</#macro>